/* Name: Nguyen Le Niem
nickname:Mark Integer
sdt:01646828033
*/
#include <stdio.h>
#include <conio.h>
#include <iostream.h>
class phanso{
      private:
              int tu;
              int mau;
      public:
             phanso(int tu=0, int mau=1){
                        this->tu=tu;
                        this->mau=mau;
                        };
             void inphanso(){
                 if(tu==0)
                  cout<<"0";
                  else
                  cout<<tu<<"/"<<mau;
                  cout<<endl;
                  };

             friend phanso operator - (phanso,phanso);
              friend phanso operator * (phanso,phanso);
               friend phanso operator / (phanso,phanso);
             friend   phanso operator + (phanso,phanso);
             };
              phanso operator + (phanso a, phanso b){
                 phanso ketqua;
                 ketqua.tu=(a.tu*b.mau)+(a.mau*b.tu);
                 ketqua.mau=a.mau*b.mau;
                 return ketqua;
                 }
          phanso operator - (phanso a, phanso b){
                 phanso ketqua;
                 ketqua.tu=(a.tu*b.mau)-(a.mau*b.tu);
                 ketqua.mau=a.mau*b.mau;
                 return ketqua;
                 }
           phanso operator * (phanso a, phanso b){
                 phanso ketqua;
                 ketqua.tu=a.tu*b.tu;
                 ketqua.mau=a.mau*b.mau;
                 return ketqua;
                 }
            phanso operator / (phanso a, phanso b){
                 phanso ketqua;
                 ketqua.tu=a.tu*b.mau;
                 ketqua.mau=a.mau*b.tu;
                 return ketqua;
                 }
           int main(){
               phanso a(1,2);
               phanso b(1,2);
               phanso c=a-b;
               phanso d=a*b;
               phanso e=a/b;
               c.inphanso();
               d.inphanso();
               e.inphanso();
               getch();
               }

